-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add population forecast schema, example, and tests #69
Conversation
Thanks for adding schema and example for population results and related tests!
Some minor things I would change:
|
Hi @henhuy, Thank you for your review! Following, I will address your points:
Yes, the schema is the same. You just have a single entry in a series in the case of one municipality. The
I'm shooting for "a default schema and differing schemas in case the schema does not fit for a special result." Still, I can't guarantee that the proposed schema will change until then. Suggestion, I will add a default schema to this PR that I extract from the population schema (which I already created with generic use in mind). Let us have 2 - 3 more implementations and finalize it on the fly. For this, we need actual data! @nesnoj, wink wink 😉
OK, I will move it.
OK, I will make the appropriate changes. |
@henhuy, finally ready 😃 after a little fight with the linter, please review the changes I made |
I made everything more generic and included |
I switched the PR to draft mode. As decided in the weekly, I will add atomic component schemas (e.g., charts) before asking for another review. |
@henhuy, I extracted an atomic chart schema and example and referenced it in the default schema. Please review this PR and merge on approval. Please note I mocked the test because the |
Again setting this PR to draft because I'm implementing in #73 the popup on map an realized I can do the format even more generic - stay tuned :) |
@henhuy, I finalized the schemas :) Please review and merge if approved! Now we have component schemas (chart and sources) and one specific schema (popup). I aim for generic components and individual schemas for specific implementations with their own specific constraints (like the popup schema has). I think this gives it a good balance between complexity and reusability. I also sliced off anything that is not absolutely needed for the client in the API response object (and for you to implement in the backend). Having a set of components will help us to construct the rest of the schemas in a faster and more generic way. However, I gave up trying to do everything generic because I realized this didn't work well. For example, the popup has specific constraints that cannot be adequately generic. And if you try to do everything generic, then I would have to define informal business logic, which constructs the appropriate data structures, in the frontend in JavaScript. This, in my opinion, is not a good solution and would make everything super messy and is the opposite of our rule for good web app architecture: "dumb frontend, intelligent backend." Therefore I vote for generic components and schemas for specific API endpoint implementations for particular needs (e.g., map popup, result page with charts, etc.). Ultimately, I think there will only be a handful of specific schemas (maybe 3 - 4). The first one is the popup schema given in this PR. |
@henhuy, please also have a look at the JSON API placeholder |
Looks very nice! This is how I imagined it. Thank you very much |
Hi @henhuy,
Please review and merge this JSON schema, example, and test implementation for the population popup on approval.
This first iteration of a JSON schema is just for the population popup. But I took the time to make it as generic as possible to be able to extend it to other popup types. I oriented myself on what we talked about in the past about good web app architecture, which is an intelligent backend and a dumb frontend. Therefore, the JSON response's custom description strings shall be created on the backend. Please look at the JSON example. This clarifies what I mean, what the backend should create, and how it should create it.
Please note, after merging, can you:
Hint: Use the example JSON as a guide. The JSON schema is visually convoluted. I had to set the indent for JSON files in the editor config to 4 spaces* to not go crazy 😉
*The formatter always reformats it to 2 spaces on commit. So no worries here!